package com.jml.jdk8.base;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: J
 * @DATE: 2022-04-15 15:40
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Student {
    private String name;
    private int score;
    private int age;

    public Student(String s) {

    }

    public Student(String name, int score) {
        this.name = name;
        this.score = score;
    }

    //按照分数比较
    public static int compareStudentByScore001(Student s1, Student s2) {
        return s1.getScore() - s2.getScore();
    }

    //按照名字比较
    public static int compareStudentByName001(Student s1, Student s2) {
        return s1.getName().compareToIgnoreCase(s2.getName());
    }

    //按照分数比较
    public int compareStudentByScore(Student student1, Student student2) {
        return student1.getScore() - student2.getScore();
    }

    //按照名字比较
    public int compareStudentByName(Student student1, Student student2) {
        return student1.getName().compareToIgnoreCase(student2.getName());
    }
}
